﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Forms;
using System.Windows.Media;

namespace UI.Classes
{
 public class LimpaCampos
    {

     public static void reset(int depth, DependencyObject obj)
     {
         // Percorre todos os filhos do objeto visual.
         for (int i = 0; i < VisualTreeHelper.GetChildrenCount(obj); i++)
             reset(depth + 1, VisualTreeHelper.GetChild(obj, i));

         // Se for um TextBox, limpa.
         if (obj is System.Windows.Controls.TextBox)
             ((System.Windows.Controls.TextBox)obj).Text = string.Empty;

         if (obj is DatePicker)
             ((DatePicker)obj).Text = string.Empty;

         if (obj is System.Windows.Controls.ComboBox)
             ((System.Windows.Controls.ComboBox)obj).Text = string.Empty;

         if (obj is System.Windows.Controls.CheckBox)
             ((System.Windows.Controls.CheckBox)obj).IsChecked = false;
         
     }
    }
}
